{% extends "tj3/tj3.html" %}


{% block content  %} 

<form action="." method="post" enctype="multipart/form-data">
<h2>General info
<input type="submit" name="command" value="task hiearchy" class="button" />
<input type="submit" name="command" value="update TJI" class="button" />
</h2>

<table>
<tbody>
<tr><td>Project<td>{{task.project.name}}</tr>
<tr><td>Task<td>{{task.name}}</tr>
<tr><td>Description<td>{{task.description}}</tr>
<tr><td>Created<td>{{task.created}}</tr>
</tbody>
</table>

<h2>Schedule<input type="submit" name="command" value="Create new period" class="button" 
/></h2>
<table>
<thead>
<th>SCENARIO<th>START<th>END<th>MAX END<th>LENGTH<th>DURATION<th>EFFORT<th>COMPLETE
<th>MILESTONE<th>MAX START<th>MIN START<th>MIN END
</thead>
<tbody>
	<!--- existing periods --->
	{% for p in periods %}
<tr>
	<td> <a href={% url period_edit p.id %}>{{p.scenario}}</a>
	<td> {{p.start}}
	<td> {{p.end}}
	<td> {{p.max_end}}
	<td> {{p.length}}
	<td> {{p.duration}}
	<td> {{p.effort}}
	<td> {{p.complete}}
	<td> {{p.milestone}}
	<td> {{p.max_start}}
	<td> {{p.min_start}}
	<td> {{p.min_end}}
</tr>
	{% endfor %}
</tbody>
</table>


<h2>Dependency
<input type="submit" name="command" value="Create new dependency" class="button" />
</h2>
<table>
<thead>
<th>TYPE<th>TO TASK<th>GAP DURATION<th>GAP LENGTH<th>ON
</thead>
<tbody>
	<!--- existing dependencies --->
	{% for d in deps %}
<tr>
	<td> <a href={% url dep_edit d.id %}>{{d.type}}</a>
	<td> <a href={% url task_detail d.to_task.id %}>{{d.to_task}}</a>
	<td> {{d.gap_duration}}
	<td> {{d.gap_length}}
	<td> {{d.on_what}}
	{% endfor %}
</tbody>
</table>

<h2>Allocated resource <input type="submit" name="command" value="Allocate resource" 
class="button" /></h2>

<table>
<tbody>
{% for r in resource_assigned %}
<tr>
	<td>Primary
	<td>
		<a href={% url resource_edit r.primary.id %}>
		{{r.primary.first_name|capfirst}} {{r.primary.last_name|capfirst}}
		</a>
	<td>
		<a href={% url worklimit_edit r.primary.work_limit.id %}>
			{{ r.primary.work_limit}}
		</a>
	<td>
		<a href={% url timeoff_create r.primary.id %}>timeoff 
		</a>		
	<td>
		<a href={% url booking_create task.id r.primary.id %}>bookings 
		</a>		
	{% if r.alternative %}
<tr>
	<td>Alternative
	<td>
		<a href={% url resource_edit r.alternative.id %}>
		{{r.alternative.first_name|capfirst}} {{r.alternative.last_name|capfirst}}
		</a>
	<td>
		<a href={% url worklimit_edit r.alternative.work_limit.id %}>
			{{ r.alternative.work_limit }}
		</a>
	<td>
		<a href={% url timeoff_create r.alternative.id %}>timeoff 
		</a>		
	<td>
		<a href={% url booking_create task.id r.alternative.id %}>bookings </a>		
	{% endif %}
	
{% endfor %}
</tbody>
</table>	


</form>
{% endblock content %}
